package com.ysfxt.controller;


import com.ysfxt.result.Result;
import com.ysfxt.service.SysTeacherService;
import com.ysfxt.service.SysWorksService;
import com.ysfxt.vo.SignUpVo;
import com.ysfxt.vo.WorksParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ysfxt
 * @since 2024-03-29
 */
@RestController
@RequestMapping("/api/sys-works")
public class SysWorksController {
    @Resource
    private SysWorksService sysWorksService;
    
    
    
    /**
     * 分页查询
     * @param worksParam
     * @return
     */
    @PostMapping("selectWorks")
    public Result selectWorks(@RequestBody WorksParam worksParam){
        return sysWorksService.select(worksParam);
    }
    
    /**
     * 导出
     * @param response
     */
    @GetMapping("exportData")
    public void exportData(HttpServletResponse response){
        sysWorksService.exportData(response);
    }
    
    /**
     * 查看详情
     * @param id
     * @return
     */
    @GetMapping("getWorkInfo/{id}")
    public Result getWorkInfo(@PathVariable Long id){
        return sysWorksService.getWorkInfo(id);
    }
    
    /**
     * 报名
     * @param signUpVo
     * @return
     */
    @PostMapping("signUp")
    public Result signUp(@RequestBody SignUpVo signUpVo){
        return sysWorksService.signUp(signUpVo);
    }
}

